﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>湖州人才网后台管理系统</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="scripts/boot.js" type="text/javascript"></script>
    <style type="text/css">
        body
        {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        .header
        {
            background: url(../header.gif) repeat-x 0 -1px;
        }
        .Note
        {
            background: url(Notes_Large.png) no-repeat;
            width: 32px;
            height: 32px;
        }
        .Reports
        {
            background: url(Reports_Large.png) no-repeat;
            width: 32px;
            height: 32px;
        }
        .north1 {
background-image: url(Styles/hd_02.gif);
background-repeat: repeat-x;
}
    </style>
</head>
<body>
    <div id="loginWindow" class="mini-window" title="用户登录" style="width:300px;height:165px;" showModal="true" showCloseButton="false">
        <div id="loginForm" style="padding:15px;padding-top:10px;">
            <table >
                <tr>
                    <td style="width:60px;"><label for="username$text">帐号：</label></td>
                    <td>
                        <input id="user" name="user" class="mini-textbox" required="true" style="width:150px;"/>
                    </td>    
                </tr>
                <tr>
                    <td style="width:60px;"><label for="pwd$text">密码：</label></td>
                    <td>
                        <input id="pwd" name="pwd"  class="mini-password" required="true" style="width:150px;"/>
                    </td>
                </tr>            
                <tr>
                    <td></td>
                    <td style="padding-top:5px;">
                        <a onclick="onLoginClick" class="mini-button" style="width:60px;">登录</a>
                        <a onclick="onResetClick" class="mini-button" style="width:60px;">重置</a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="layout1" class="mini-layout" style="width: 100%; height: 100%;">
        <div class="header north1" region="north" height="70" showsplit="false" showheader="false" >
<!--            <h1 style="margin: 0; padding: 15px; cursor: default; font-family: 微软雅黑,黑体,宋体;">-->
<!--                湖州人才网后台管理系统</h1>-->
            <div  style="position:static; height:68px; width:412px; background-image:url(Styles/hd.jpg);background-repeat :no-repeat; "> </div>
            <div style="position: absolute; top: 18px; right: 10px;">
                <span id="welcome" style="width:300px;"></span>
                <a class="mini-button mini-button-iconTop" iconCls="icon-home" onclick="onClick" plain="true" >前台首页</a>
                <a class="mini-button mini-button-iconTop" iconCls="icon-edit" onclick="pwchange" plain="true">修改密码</a>
<!--                <a class="mini-button mini-button-iconTop" iconCls="icon-sethome" onclick="create" plain="true">生成首页</a>-->
                <a class="mini-button mini-button-iconTop" iconCls="icon-exit" onclick="logout" plain="true" >注销</a>     
                <a class="mini-button mini-button-iconTop" iconCls="icon-close2" onclick="closewin" plain="true" >关闭</a>
            </div>
        </div>
        <div title="south" region="south" showSplit="false" showHeader="false" height="30">
            <div style="line-height:28px;text-align:center;cursor:default">Copyright © 湖州飞灵科技电子有限公司版权所有</div>
        </div>
        <div title="系统菜单" showHeader="true" region="west" width="200" maxwidth="200" minwidth="150" bodyStyle="padding-left:1px;" showSplitIcon="true">
            <!--OutlookMenu-->
            <div id="outlookmenu" class="mini-outlookmenu" url="data/system.aspx?method=GetMenu" onitemclick="onItemClick"
                idfield="ml_no" parentfield="ml_pid" textfield="ml_name" urlfield="ml_url">
            </div>
        </div>
        <div title="center" region="center" style="border:0;" bodyStyle="overflow:hidden;">
            <!--Tabs-->
            <div id="mainTabs" class="mini-tabs" activeindex="0" style="width: 100%; height: 100%;" refreshOnClick="true">
                <div title="首页" url="welcome.html" ></div>
            </div>
        </div>
    </div>
    
    <div id="editWindow" class="mini-window" title="修改密码" style="width: 250px;" showmodal="true"
        allowresize="false" allowdrag="true" showFooter="true">
        <div id="editform" class="form">
            <table style="width: 98%; height: 100%;">
                <tr style="height: 20px">
                    <td class="tdtitle">
                        旧密码：
                    </td>
                    <td class="tdtext">
                        <input id="su_pwd" name="su_pwd" class="mini-password" required="true" style="width:120px;"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        新密码：
                    </td>
                    <td class="tdtext">
                        <input id="new_pwd" name="new_pwd" class="mini-password" required="true" style="width:120px;" onvalidation="onPwdValidation"/>
                    </td>
                </tr>
                <tr style="height: 20px">
                    <td class="tdtitle">
                        确认密码：
                    </td>
                    <td class="tdtext">
                        <input id="ck_pwd" name="ck_pwd" class="mini-password" required="true" style="width:120px;" onvalidation="onPwd2Validation"/>
                    </td>
                </tr>
            </table>
        </div>
        <div property="footer" style="text-align:center;padding:5px;">
            <a class="mini-button" style="width:60px;" onclick="updatepw()">保存</a>
            <span style="display:inline-block;width:25px;"></span>
            <a class="mini-button" style="width:60px;" onclick="close()">关闭</a>
        </div>
    </div>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",// 解决乱码问题，设置全局ajax
            complete: function (XMLHttpRequest, textStatus) {
                // 通过XMLHttpRequest取得响应头，sessionstatus
                var sessionstatus = XMLHttpRequest.getResponseHeader("sessionstatus");
                if (XMLHttpRequest.responseText == "out") {
                    window.location = "login.html";
                }
            }
        });
        mini.parse();

        $(document).ready(function () {
            $.ajax({
                url: "data/system.aspx?method=GetLoginInfor",
                success: function (text) {
                    if (text == "out") {
                        window.location = "login.html";
                    }
                    var o = mini.decode(text);
                    $("#welcome").html("欢迎您："+ o.su_login);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    ShowMessage("系统提示", "页面加载出错！", 3);
                }
            });
        });

        function onBeforeOpen(e) {
            currentTab = tabs.getTabByEvent(e.htmlEvent);
            if (!currentTab) {
                e.cancel = true;
            }
        }

        function showTab(node) {
            var tabs = mini.get("mainTabs");
            var id = "tab$" + node.ml_no;
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab.name = id;
                tab.title = node.text;
                tab.showCloseButton = true;
                tab.url = node.url;
                tabs.addTab(tab);
                tabs.activeTab(tab);
            } else {
                if (tab.enabled == true) {
                    tabs.activeTab(tab);
                }
            }
        }

        function onItemClick(e) {
            var item = e.item;
            showTab(item);
        }

        function closeTab() {
            tabs.removeTab(currentTab);
        }
        function closeAllBut() {
            tabs.removeAll(currentTab);
        }
        function closeAll() {
            tabs.removeAll();
        }
        function closeAllButFirst() {
            var but = [currentTab];
            but.push(tabs.getTab("first"));
            tabs.removeAll(but);
        }

        function closewin() {
            mini.confirm("确定退出系统？", "系统提示", function (action) {
                if (action == "ok") {
                    window.opener = null;
                    window.open("", "_self");
                    window.close();
                }
            });
        }

        function logout() {
            $.ajax({
                url: "data/system.aspx?method=LogOut",
                type: "post",
                success: function (text) {
                    window.location.replace("login.html");
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    ShowMessage("系统提示", "注销失败！", 3);
                }
            });
        }

        function pwchange() {
            var form = new mini.Form("#editform");
            form.reset();
            form.loading();
            form.unmask();
            var win = mini.get("editWindow");
            if (!win.visible)
                win.show();
        }

        function onPwdValidation(e) {
            if (e.isValid) {
                if (e.value.length < 6) {
                    e.errorText = "密码不能少于6个字符";
                    e.isValid = false;
                }
            }
        }

        function onPwd2Validation(e) {
            if (e.isValid) {
                if (e.value.length < 6) {
                    e.errorText = "密码不能少于6个字符";
                    e.isValid = false;
                }
                else {
                    var pw = mini.get("new_pwd").getValue();
                    if (pw != e.value) {
                        e.errorText = "两次输入的密码不一致";
                        e.isValid = false;
                    }
                }
            }
        }

        function updatepw() {
            var form = new mini.Form("#editform");
            form.validate();
            if (form.isValid() == false)
                return;
            var o = form.getData();
            var json = mini.encode(o);
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '保存中...' });

            $.ajax({
                url: "data/system.aspx?method=ChangePW",
                data: { data: json },
                success: function (ret) {
                    mini.unmask(document.body);
                    if (ret == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    var editWindow = mini.get("editWindow");
                    if (ret > 0) {
                        editWindow.hide();
                        ShowMessage("系统提示", "密码修改成功！", 1);
                    }
                    else if (ret == 0) {
                        mini.showMessageBox({
                            title: "系统提示",
                            iconCls: "mini-messagebox-warning",
                            buttons: ["ok"],
                            message: "账号已不存在，请确认！",
                            callback: function (action) {
                                window.location.replace("login.html");
                            }
                        });
                    }
                    else if (ret == -2) {
                        ShowMessage("系统提示", "旧密码不正确，请确认！", 2);
                    }
                    else
                        ShowMessage("系统提示", "密码修改失败！", 3);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "密码修改失败！", 3);
                }
            });
        }

        function close() {
            var win = mini.get("editWindow");
            win.hide();
        }

        function onLoginClick(e) {
            var form = new mini.Form("#loginWindow");

            form.validate();
            if (form.isValid() == false)
                return;
            //提交数据
            var data = form.getData();
            var json = mini.encode(data);
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '验证中，请稍后......' });

            $.ajax({
                url: "data/logincheck.aspx?method=Login2",
                type: "post",
                data: { data: json },
                success: function (text) {
                    mini.unmask(document.body);
                    if (text == '通过') {
                        var form = new mini.Form("#loginWindow");
                        form.clear();
                        var win = mini.get("loginWindow");
                        win.hide();
                    }
                    else {
                        ShowMessage("系统提示", text, 2);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "服务器链接失败！", 3);
                }
            });
        }

        function onResetClick(e) {
            var form = new mini.Form("#loginWindow");
            form.clear();
        }

        function onClick(e) {
            window.open("../Web/Index.html");
        }

        function create() {
            mini.confirm("确定生成静态页面？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });

                        $.ajax({
                            url: "data/system.aspx?method=CreateHtml",
                            type: "post",
                            data: { webset: webset },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret == 1) {
                                    ShowMessage("系统提示", "静态页面生成成功！", 1);
                                }
                                else
                                    ShowMessage("系统提示", "静态页面生成失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "静态页面生成失败！", 3);
                            }
                        });
                    }
                }
            );
        }
    </script>
</body>
</html>
